/**
 * Copyright (c) 2016-2021 by the respective copyright holders.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package com.zsmartsystems.zigbee.dongle.telegesis.internal.protocol;


/**
 * Class to implement the Telegesis command <b>Ack Message</b>.
 * <p>
 * Acknowledgement for message XX was received
 * <p>
 * This class provides methods for processing Telegesis AT API commands.
 * <p>
 * Note that this code is autogenerated. Manual changes may be overwritten.
 *
 * @author Chris Jackson - Initial contribution of Java code generator
 */
public class TelegesisAckMessageEvent extends TelegesisFrame implements TelegesisEvent {
    /**
     * ACK response field
     */
    private Integer messageId;

    /**
     *
     * @return the messageId as {@link Integer}
     */
    public Integer getMessageId() {
        return messageId;
    }


    @Override
    public void deserialize(int[] data) {
        initialiseDeserializer(data);

        // Deserialize the fields for the "ACK" response
        if (testPrompt(data, "ACK:")) {
            setDeserializer(4);

            // Deserialize field "message ID"
            messageId = deserializeInt8();
        }
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder(204);
        builder.append("TelegesisAckMessageEvent [messageId=");
        builder.append(messageId);
        builder.append(']');
        return builder.toString();
    }
}
